<template>
  <view class="cardstyle">
    <slot name="header"></slot>
    <text class="titlebox">{{title}}</text>
    <view class="tipsbox">
      <text style="color:#f00;" v-if="isTop">置顶</text>
      <text>{{author}}</text>
      <text>{{comments}}评</text>
      <view style="flex:1; display: flex; justify-content: flex-end;">
        <text>{{time}}</text>
      </view>
    </view>
    <slot name="tips"></slot>
  </view>
</template>

<script>
export default {
  name: "cardViewText",
  props: {
    title: {
      type: String,
      required: true,
      default: "新闻标题"
    },
    isTop: {
      type: Boolean,
      required: true,
      default: false
    },
    author: {
      type: String,
      required: true,
      default: "来源"
    },
    comments: {
      type: Number,
      required: true,
      default: 0
    },
    time: {
      type: String,
      required: true,
      default: "2025.1.1"
    },
    nID: {
      type: String,
      default: ""
    }
  },
  data() {
    return {};
  }
};
</script>

<style scoped>
.cardstyle {
  background-color: azure;
  padding: 20rpx;
  margin: 10rpx;
  border-radius: 10rpx;
  box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}
.titlebox {
  display: block;
  font-size: 32rpx;
  font-weight: 500;
  color: #333333;
  margin-bottom: 12rpx;
  line-height: 1.5;
}
.tipsbox {
  display: flex;
  align-items: center;
  font-size: 24rpx;
  color: #666666;
  flex-wrap: wrap;
}
.tipsbox text {
  margin-right: 20rpx;
}
</style>